package cn.net.gemai.springboot_mybatis.controller;

import cn.net.gemai.springboot_mybatis.entity.Person;
import cn.net.gemai.springboot_mybatis.service.PersonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.imageio.plugins.jpeg.JPEGImageReadParam;
import java.util.List;

@RestController
@RequestMapping("/v1")
public class PersonController {

    @RequestMapping("/hello")
    public String sayHello(){
        return "Hello SpringBoot!";
    }

    @Autowired
    private PersonService personService;

    @RequestMapping("/selectAll")
    public List<Person> selectAll() {
        List<Person> list = personService.selectAll();
        return list;
    }

    @GetMapping("/selectById")
    public Person selectById() {
        Person person = personService.selectById(1);
        return person;
    }
}
